/*
 * 
 */

package milecToMinisat;

/**
* This enumeration aim to list  all integer operation understood
* by MILEC. 
* @author ter-topcased-ups
* @version 0.01, 2008/07/03
* @see 
*/
public enum IntegerOperator {
	addition {
		public int getSize(IntegerExp leftSide, IntegerExp rightSide) {
			return Math.max(leftSide.getSize(),rightSide.getSize()) ;
		}
		
		public void genIntegerOp(IntegerVariable finalLeft , IntegerVariable finalRight,  IntegerVariable tmp) {
			Converter.getInstance().genIntegerAdd(finalLeft, finalRight, tmp) ;
		}
	} ,
	subtraction {
		public int getSize(IntegerExp leftSide, IntegerExp rightSide) {
			return Math.max(leftSide.getSize(),rightSide.getSize()) ;
		}
		
		public void genIntegerOp(IntegerVariable finalLeft , IntegerVariable finalRight,  IntegerVariable tmp) {
			Converter.getInstance().genIntegerSub(finalLeft, finalRight, tmp) ;
		}
	} ,
	multiplication {
		public int getSize(IntegerExp leftSide, IntegerExp rightSide) {
			return leftSide.getSize() + rightSide.getSize();
		}
		
		public void genIntegerOp(IntegerVariable finalLeft , IntegerVariable finalRight,  IntegerVariable tmp) {
			Converter.getInstance().genIntegerMul(finalLeft, finalRight, tmp) ;
		}
	} ,
	division {
		public int getSize(IntegerExp leftSide, IntegerExp rightSide) {
			return  leftSide.getSize();
		}
		
		public void genIntegerOp(IntegerVariable finalLeft , IntegerVariable finalRight,  IntegerVariable tmp) {
			Converter.getInstance().genIntegerDiv(finalLeft, finalRight, tmp) ;
		}
	} ,
	modulo {
		public int getSize(IntegerExp leftSide, IntegerExp rightSide) {
			return rightSide.getSize();
		}

		public void genIntegerOp(IntegerVariable finalLeft , IntegerVariable finalRight,  IntegerVariable tmp) {
			Converter.getInstance().genIntegerMod(finalLeft, finalRight, tmp) ;
		}
	}  ;
	
	
	abstract public int getSize(IntegerExp leftSide, IntegerExp rightSide) ;
	
	public void genIntegerOp(IntegerVariable finalLeft , IntegerVariable finalRight,  IntegerVariable tmp) {
		
	}
}
